package com.umakr.ax.app.web;

import com.umakr.ax.common.service.ShowDiscussService;
import com.umakr.ax.common.service.ShowFabulousService;
import com.umakr.ax.core.base.AbstractController;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 秀评论  前端控制器
 * </p>
 *
 * @author Umakr-Code-Generator
 * @since 2017-12-30
 */
@Controller
@RequestMapping("/api/showDiscuss")
public class ShowDiscussAppController extends AbstractController {
	@Autowired
	ShowDiscussService showDiscussService;
	@Autowired
	ShowFabulousService showFabulousService;

	/**
	 * @author 唐腾飞
	 * @param modelMap
	 * @param userId
	 * @param showId
	 * @return
	 */
	@ApiOperation(value = "获取秀平评论列表")
	@GetMapping("/load")
	@ResponseBody
	public Object load(ModelMap modelMap, Long userId,Long showId) {
		return setSuccessModelMap(modelMap,showDiscussService.load(userId,showId));
	}

	/**
	 * @autor 唐腾飞
	 * @param modelMap
	 * @param userId
	 * @param rsId
	 * @param showId
	 * @param commentContent
	 * @return
	 */
	@ApiOperation(value = "秀评论")
	@PostMapping(value = "/discuss")
	public Object discuss(ModelMap modelMap, @RequestParam(name = "userId") Long userId,
						  @RequestParam(name = "rsId") Long rsId,
						  @RequestParam(name = "showId") Long showId,
						  @RequestParam(name = "commentContent") String commentContent) {
		return setSuccessModelMap(modelMap,showDiscussService.discuss(userId,rsId,showId,commentContent));
	}


	/**
	 * @author 唐腾飞
	 * @param modelMap
	 * @param userId        此处的userId 是否是当前登录用户的userId 需要确认一下
	 * @param rsId
	 * @param showId
	 * @param id
	 * @return
	 */
	@ApiOperation(value = "软删除电台秀评论")
	@GetMapping("/discussDel")
	@ResponseBody
	public Object discussDel(ModelMap modelMap, Long userId,Long rsId,Long showId,Long id) {
		return setSuccessModelMap(modelMap,showDiscussService.discussDel(userId,rsId,showId,id));
	}
}